<?php

// Defaults
$Sp_Chr = "";
// File Data
$f = 1;
$log = '';

// Orders
/*$_sysGetCorrespondentStatusCode = array(0 => 'Na', 1 => 'Registred', 2 => 'Incident', 3 => 'Paid', 4 => 'Cancelled', 5 => 'Pre-Cancellation');
$_sysGetCorrespondentIncidentCode = array(0 => 'Na', 1 => 'Registred', 2 => 'In process', 3 => 'Processed', 4 => 'Cancelled');
$__tftTransactionStatusCode = array('7' => '1', '9' => '4', '11' => '3');
*/
$_sysGetCorrespondentStatusCodeDescription = array(0=>'Na',1=>'Registred',2=>'Incident',3=>'Paid',4=>'Cancelled',5=>'Pre-Cancellation');
$_sysGetCorrespondentIncidentCode = array(0=>'Na',1=>'Registred',2=>'In process',3=>'Processed',4=>'Cancelled');
$__tftTransactionStatusCode = array('7'=>'1','9'=>'4','11'=>'3');
$__tftGetCorrespondentStatusCode = array('2'=>'1','3'=>'1','16'=>'1','8'=>'2','11'=>'3','9'=>'4','18'=>'5','19','5');


$List = $GLOBALS['MYT']->db_array($max);

for ($y = 1; $y <= $List[0]; $y++) {
    # Single Transaction File
    $handle = fopen($filename, "x");

    $log .= '<Transaction>
<CodeTransaction>6950' . $List[$y]['FraReferenciaCo'] . '</CodeTransaction>
<TransactionVersion>1</TransactionVersion>
<UniqueTransactionId>6950' . $List[$y]['FraReferenciaCo'] . '</UniqueTransactionId>
<TransactionDate>
<Year>' . substr($List[$y]['FraFecha'], 6, 4) . '</Year>
<Month>' . substr($List[$y]['FraFecha'], 3, 2) . '</Month>
<Day>' . substr($List[$y]['FraFecha'], 0, 2) . '</Day>
<Hour>' . substr($List[$y]['FraHora'], 0, 2) . '</Hour>
<Min>' . substr($List[$y]['FraHora'], 3, 2) . '</Min>
<Sec>' . substr($List[$y]['FraHora'], 6, 2) . '</Sec>
</TransactionDate>
<CodeTransactionStatus>' . $__tftTransactionStatusCode[$List[$y]['FraStatus']] . '</CodeTransactionStatus>
<TransactionStatusDescription>' . $_sysGetCorrespondentStatusCode[$__tftTransactionStatusCode[$List[$y]['FraStatus']]] . '</TransactionStatusDescription>
<Notes></Notes>
<Sender>
<SenderName>' . $List[$y]['CliNombre'] . '</SenderName>
<SenderStreet>' . '</SenderStreet>
<SenderZipCode>' . '</SenderZipCode>
<SenderCity>' . $List[$y]['CliCiudad'] . '</SenderCity>
<SenderCountry IsoCodeAlphaCountry="' . $List[$y]['CliPaisCode'] . '" IsoCodeCountry="' . $List[$y]['CliPaisISONum'] . '"/>
<SenderEmail></SenderEmail>
<SenderPhone></SenderPhone>
<SenderMobile/>
<SenderFax></SenderFax>
<SenderIdentity>
<Document>' . $List[$y]['CliDNI'] . '</Document>
<DocumentValidity>
<Year></Year>
<Month></Month>
<Day></Day>
</DocumentValidity>
</SenderIdentity>
</Sender>
<Receiver>
<ReceiverName>' . $List[$y]['BnfNombre'] . '</ReceiverName>
<ReceiverStreet>' . $List[$y]['BnfDireccion'] . '</ReceiverStreet>
<ReceiverZipCode></ReceiverZipCode>
<ReceiverCity>' . $List[$y]['CliCiudad'] . '</ReceiverCity>
<ReceiverCountry IsoCodeAlphaCountry="' . $List[$y]['BnfPaisCode'] . '" IsoCodeCountry="' . $List[$y]['BnfPaisISONum'] . '"/>
<ReceiverEmail></ReceiverEmail>
<ReceiverPhone>' . $List[$y]['BnfTelefono'] . '</ReceiverPhone>
<ReceiverMobile>' . $List[$y]['BnfTelefono2'] . '</ReceiverMobile>
<ReceiverFax></ReceiverFax>
<BankName>' . $List[$y]['cb_Banco'] . '</BankName>
<AgencyName></AgencyName>
<AccountNumber>' . $List[$y]['cb_Sucursal'] . '</AccountNumber>
</Receiver>
<Destination>
<CodeDestination>' . $List[$y]['FraAgenciaPago'] . '</CodeDestination>
</Destination>
<Invoice>
<ReceiveValue>' . $List[$y]['FraARecibir'] . '</ReceiveValue>
<IsoCodeCurrency>' . $List[$y]['FraMonDPago'] . '<IsoCodeCurrency>
</Invoice>
</Transaction>';
    fwrite($handle, $log);
    fclose($handle);
}
?>